<?php

function print_z($var){
    echo("<pre>");
    print_r($var);
    echo("</pre>");
}

function redirect($url,$code){
    header("Location: ".$url,true,$code);
}

function arrValue($arr,$arrIndex,$default=null){
    $ret = null;
    if(array_key_exists($arrIndex,$arr)){
        $ret = $arr[$arrIndex];
    }
    else
    {
        $ret = $default;
    }

    return $ret;
}

function checkUser($type=null){
    switch($type){
        case 'A':
            if(!array_key_exists('ADM_USR',$_SESSION)){
                 redirect("/login/?T=A",302);        
            }   
        break;
        default:
            if(!array_key_exists('USR',$_SESSION)){
                 redirect("/login/",302);        
            }  
        break;
    }
}


?>